package com.gorun;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
@Slf4j
public class WechatRobotApplication {

	public static void main(String[] args) {
		SpringApplication.run(WechatRobotApplication.class, args);
	}

	@Bean
	public CommandLineRunner run(WeChatStart weChatStart) throws Exception {
		Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
			log.error(e.getMessage(), e);
			System.exit(1);
		});
		return args -> weChatStart.start();
	}

}
